#
# The Ledger: all monetary transactions should go through this class
#
# that way we can build statistics about who's earning the most and
# and who's costing the most, and generate financial reports
#
# We should have done this from the start in vanilla WM.
# Let's get it right this time :)
#

class Purchase(object):
        def __init__(self, price, **kw):
                object.__init__(self)
                self.price	= price
                self.what	= kw.get("what", "")    # what we bought
                self.benefit	= kw.get("benefit", "")	# who benefits
		self.category	= kw.get("category", "")# food/tax/new slave...
                self.vendor	= kw.get("vendor", "")	# who sold
                self.group	= kw.get("group","")	# who sold
                self.brothel	= kw.get("brothel","")	# where based
		self.quarter	= kw.get("quarter", "")	# city quarter
		self.approved	= kw.get("approved", "")# approved by ...
		self.tags	= kw.get("tags", "")	# arbitrary text tags
	@property
	def gold(self):
		return  -1 * self.price

class Sale(object):
        def __init__(self, price, **kw):
                object.__init__(self)
                self.price	= price
                self.what	= kw.get("what", "")    # what we sold
                self.buyer	= kw.get("buyer", "")	# who sold
                self.benefit	= kw.get("benefit", "")	# who benefits
		self.provider	= kw.get("provider", "")# service provider
		self.category	= kw.get("category", "")# sex/slave/item...
                self.group	= kw.get("group","")	# who sold
		self.act	= kw.get("act", "")	# specfic sex act
                self.brothel	= kw.get("brothel","")	# where based
		self.quarter	= kw.get("quarter", "")	# city quarter
		self.approved	= kw.get("approved", "")# approved by ...
		self.tags	= kw.get("tags", "")	# arbitrary text tags

	@property
	def gold(self):
		return  self.price

class Ledger(object):
        def __init__(self, data):
                object.__init__(self)
		self._gold = 0
		self.transactions = []
		self.game_data = data

	def add(self, transact):
		self._gold += transact.gold
		transact.day = self.game_data.day
		self.transactions.append(transact)

	def buy(self, price, **kw):
		print price
		print kw
		trans = Purchase(price, **kw)
		self.add(trans)
		return True

#
#	just to help guard against absent minded direct access
#	we'll make the gold property a read only
#
#	considered calling this "sigils" after the AC currency.
#	but I'd forget and other people might never make the connection
#	so let's not
#
	@property
	def gold(self):
		return self._gold

